1. Field of the Invention
The present invention relates to a computer program product, system, and method for managing metadata for data in a copy relationship.
2. Description of the Related Art
In a storage environment, source volumes may be mirrored to target volumes to provide redundant copies of data. The source and target volumes may be in different storage devices to provide further redundancy. A point-in-time copy replicates data in a manner that appears instantaneous and allows a host to continue accessing the source volume while actual data transfers to the copy volume are deferred to a later time. The point-in-time copy appears instantaneous because complete is returned to the copy operation in response to generating the relationship data structures without copying the data. The point-in-time copy relationships that are immediately established in response to the point-in-time copy command include a bitmap or other data structure indicating the location of blocks in the volume at either the source volume or the copy volume.
Point-in-time copy techniques, such as the IBM FlashCopy® (FlashCopy is a registered trademark of International Business Machines, Corp. or “IBM”), typically defer the transfer of the source volume tracks in the copy relationship to the corresponding target volume until a write operation is requested to that data block on the source volume. Data transfers may also proceed as a background copy process with minimal impact on system performance. Further, a source track in the copy relationship may be copied to the corresponding target track in the copy relationship in response to a read request to the corresponding target track.
A command to withdraw the copy relationship may be submitted. To implement a copy relationship withdraw operation, the target metadata for all the target volume tracks in the copy relationship is discarded in the target storage system and any target tracks in the copy relationship, modified or unmodified, residing in cache, are demoted, i.e., discarded. As part of the copy relationship withdraw operation, access to the target volume is quiesced until all the metadata for the target volume in the target storage is discarded. Following the withdraw operation, the target metadata for a requested target track needs to be rebuilt when the target track is subsequently requested because all the metadata for the target volume in the target storage was discarded during the copy relationship withdraw operation.
The target metadata for the target volume is discarded to prevent a mismatch of the target metadata data in the target storage and the target tracks described by the metadata. This mismatch may occur if at the time of the withdraw operation, target metadata for modified target tracks in cache is destaged to the target storage before the modified target tracks. For this reason, during the copy withdraw operation, all target metadata in the volume is discarded to avoid this mismatch of the target storage having target metadata having information that is inconsistent with the corresponding target tracks in the target storage.
There is a need in the art for improved techniques for managing metadata in the storage system and cache.